package com.sunyard.pcc.core.manager.impl;

import com.sunyard.michiru.common.entity.PageResult;
import com.sunyard.pcc.dal.model.SysRoleMenuDO;
import com.sunyard.pcc.dal.query.SysRoleMenuQuery;
import com.sunyard.pcc.dal.mapper.ext.SysRoleMenuExtMapper;
import com.sunyard.pcc.core.manager.SysRoleMenuManager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Manager for SysRoleMenu.
 */
@Component
public class SysRoleMenuManagerImpl implements SysRoleMenuManager{

    
    @Autowired
    protected SysRoleMenuExtMapper sysRoleMenuExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(SysRoleMenuQuery query){
        return sysRoleMenuExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(SysRoleMenuQuery query){
        return sysRoleMenuExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(SysRoleMenuDO record){
        return sysRoleMenuExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(SysRoleMenuDO record){
        return sysRoleMenuExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<SysRoleMenuDO> selectByQuery(SysRoleMenuQuery query){
        return sysRoleMenuExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<SysRoleMenuDO> selectByQueryWithPage(SysRoleMenuQuery query) {
        PageResult<SysRoleMenuDO> result = new PageResult<SysRoleMenuDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public SysRoleMenuDO selectByPrimaryKey(Long id){
        return sysRoleMenuExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( SysRoleMenuDO record,  SysRoleMenuQuery query){
        return sysRoleMenuExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( SysRoleMenuDO record,  SysRoleMenuQuery query){

        return sysRoleMenuExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(SysRoleMenuDO record){
        return sysRoleMenuExtMapper.updateByPrimaryKeySelective(record);
    }

}